const BaseHandler     = require('../base-handler');
const SystemServices  = require('../../../constants').SystemServices;
const HTTP_VERBS      = require('../../../constants').HTTP_VERBS;

class VersionHandler extends BaseHandler {
    get pattern() {
        return "/version";
    }

    doGET(request, response) {
        
        if (request.session.user.authenticated) {
            response.render('version', {
                user: request.session.user
            });
        } else {
            response.redirect('/login');
        }
    }

    setup() {
        this.registerVerb(HTTP_VERBS.GET, this.doGET);
    }
}

module.exports = VersionHandler;